// 轮播图部分
var mySwiper = new Swiper('.swiper', {
    direction: 'horizontal', // 横向切换切换选项
    loop: true, // 循环模式选项

    // 如果需要分页器
    pagination: {
        el: '.swiper-pagination',
    },

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },

    // 如果需要滚动条
    // scrollbar: {
    //     el: '.swiper-scrollbar',
    // },
    // 自动切换
    autoplay: true,
    // slidesPerView: auto,
})
// 热门试用部分
$(function () {
    window.onload = function () {
        // 报告精选
        $.ajax({
            url: 'http://localhost:3000/report/hot',
            type: 'get',
            success: function (res) {
                var str = '';
                console.log(res.splice(0, 8));

                $.each(res.splice(0, 8), function (index, item) {
                    str += '<li>' + '<img class = "img1"src =' + item.img + '><p> ' + item.text + '</p><span> ●' + item.uName + ' </span><span class = "simg"><img src = "../img/small/reply.png"> 3 </span><span class = "simg"><img src = "../img/small/zan.png">3</span></li > '

                })
                $('.report-ul').append(str);
            }
        });
        // 导购精选
        $.ajax({
            url: 'http://localhost:3000/guid/hot',
            type: 'get',
            success: function (date) {
                var arr = '';
                $.each(date.splice(0, 4), function (i, item) {
                    arr += '<li>' + '<img class = "img1"src =' + item.img + '><p> ' + item.text + '</p><span class = "simg"><img src = "../img/small/reply.png"> 3 </span><span class = "simg"><img src = "../img/small/zan.png">3</span></li > '

                })
                $('.guid-shop-ul').append(arr);
            }
        });
        // 发现酷玩
        $.ajax({
            url: 'http://localhost:3000/play/new',
            type: 'get',
            success: function (pla) {
                console.log(pla);
                var plarr = '';
                $.each(pla[2], function (i, item) {
                    plarr += '<li>' + '<img class = "img1" src =' + item.img + '><p> ' + item.text + '</p><span class="price">' + item.price + '</span><span class = "simg"><img src = "../img/small/reply.png"> 3 </span><span class = "simg"><img src = "../img/small/zan.png">3</span></li >'
                })
                $('.ku-play-ul').append(plarr);
            }
        });
    }
})